﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTOFrameworks;
using FooFun.DataElements.Dtos;

namespace FAQFrameworks
{
    public class PageTitleUtil
    {
        public static string Default
        {
            get
            {
                return Join("首页-", SiteName);
            }
        }

        public static string TopicTitle
        {
            get
            {
                TopicManager topicManager = new TopicManager();
                // todo: 没有异常处理
                try
                {
                    IDataElement topic
                        = topicManager.GetElement(FAQContext.Current.TopicId);
                    return Join(topic["Title"]["Content"].ToString(), SiteName);
                }
                catch
                { }

                return SiteName;
            }
        }

        public static string SiteName
        {
            get
            {
                return "FAQ在线求助系统";
            }
        }

        public static string AskQuestion
        {
            get
            {
                return Join("提问问题-", SiteName);
            }
        }

        public static string Join(params string[] strs)
        {
            return string.Join("-", strs);
        }
    }
}
